#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 25;
const int D = (1 << 24) + 5;
int n;
int xo, yo;
int x[N], y[N];
int dp[D];
pii act[D];
int dis(int i, int j) {
  int dx = x[i] - x[j], dy = y[i] - y[j];
  return dx * dx + dy * dy;
}
void solve() {
  cin >> xo >> yo >> n;
  rep(i, 0, n - 1) cin >> x[i] >> y[i];
  x[n] = xo, y[n] = yo;
  memset(dp, 0x3f, sizeof(dp));
  int mx = (1 << n) - 1;
  dp[0] = 0;
  rep(s, 0, mx - 1) {
    // solve the least bit
    bitset<24> bs(s);
    int i = 0;
    while (i < n && bs[i]) i++;  // get the least bit
    // single move
    int s1 = 1 << i | s;
    int d = 2 * dis(i, n);
    if (dp[s1] > dp[s] + d) {
      dp[s1] = dp[s] + d;
      act[s1] = pii(i, i);
    }
    // double move
    rep(j, i + 1, n - 1) {
      if (!bs[j]) {
        int s2 = (1 << i) | (1 << j) | s;
        int d = dis(i, n) + dis(j, n) + dis(i, j);
        if (dp[s2] > dp[s] + d) {
          dp[s2] = dp[s] + d;
          act[s2] = pii(i, j);
        }
      }
    }
  }
  cout << dp[mx] << endl;
  vector<pii> res;
  int s = mx;
  cout << 0 << ' ';
  while (s) {
    pii now = act[s];
    int i = now.first, j = now.second;
    res.push_back(now);
    s ^= 1 << i;
    cout << i + 1 << ' ';
    if (j != i) {
      s ^= 1 << j;
      cout << j + 1 << ' ';
    }
    cout << 0 << ' ';
  }
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}